# _*_ coding : utf-8 _*_
# @Time : 2023/12/12 9:25
# @Author : 韩宗森
# @File : 26_selenium_handle
# @Project : pythonProject


from selenium import webdriver
from selenium.webdriver.chrome.options import Options


def share_browser():
    chrome_options = Options()
    chrome_options.add_argument('--headless')
    chrome_options.add_argument('--disable-gpu')

    # 谷歌浏览器的路径
    path = r'C:\Users\Administrator\AppData\Local\google\Chrome\Application\chrome.exe'
    chrome_options.binary_location = path

    browser = webdriver.Chrome(chrome_options)
    return browser


url = 'https://www.baidu.com'

browser = share_browser()
browser.get(url)

#
browser.save_screenshot('baidu.png')
